package com.zhanghe.springboot.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.zhanghe.springboot.mapper.testmapper;
import com.zhanghe.springboot.model.TestModel;
import com.zhanghe.springboot.service.testService;
@Service
@Transactional //添加事务
public class testServiceImpl implements testService {
	@Autowired
	public testmapper mapper;
	
	public TestModel findByid(String id) {
		return mapper.findByid(id);
	}
	public int updateById(String id,String name){
		int i= mapper.updateById(id, name);
		i=1/0;//故意报错用于检测事务
		return i;
	}

}
